package mars_car;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.sxt.mars.util.LoggerUtil;

public class BaseTest
{
	protected ApplicationContext ac;

	
	//初始化配置文件
	@Before
	public void info()
	{
    this.ac=new ClassPathXmlApplicationContext("classpath*:com/sxt/mars/config/applicationContext-*.xml");
     LoggerUtil.LOGGER.info("初始化正常");
	}
	
	
	@Test
	public void test(){
		LoggerUtil.LOGGER.info("=======Test======");
	}
	
	//关闭资源
	@After
	public void cloess(){
		if(this.ac instanceof ClassPathXmlApplicationContext){
			ClassPathXmlApplicationContext  cpac =(ClassPathXmlApplicationContext) this.ac;
			cpac.close();
			LoggerUtil.LOGGER.info("关闭");
		}
	}
}
